<template>
  <el-main>
      <div v-show="isShow" style="height:100%;">
      <!-- 主页部分 -->
          <!-- mian的头部 -->
      <div class="main-top">
          <div class="top1">
              <div class="top1-tip">
                  <span>火灾监测报警系统</span>
                  <div class="refresh" @click="refresh">
                      <i class="iconfont icon-refresh"></i>
                      <span>刷新</span>
                  </div>
              </div>
              <div class="top1-time">
                  <p><span>数据更新时间：</span><span>{{time()}}</span></p>
              </div>
          </div>
          <div class="top2">
              <div class="top2-icon"><i class="iconfont icon-equipment"></i></div>
              <div class="top2-tip">
                  <span>全部设备</span>
                  <p>{{fmTotal+fmnTotal}}</p>
              </div>
          </div>
          <div class="top2">
              <div class="top2-icon"><i class="iconfont icon-normal"></i></div>
              <div class="top2-tip">
                  <span>正常</span>
                  <p>{{fmStatus.正常+fmnStatus.正常}}</p>
              </div>
          </div>
          <div class="top2">
              <div class="top2-icon"><i class="iconfont icon-alarm"></i></div>
              <div class="top2-tip">
                  <span>报警</span>
                  <p>{{fmStatus.报警+fmnStatus.报警}}</p>
              </div>
          </div>
          <div class="top2">
              <div class="top2-icon"><i class="iconfont icon-fault"></i></div>
              <div class="top2-tip">
                  <span>故障</span>
                  <p>{{fmStatus.故障+fmnStatus.故障}}</p>
              </div>
          </div>
          <div class="top2">
              <div class="top2-icon"><i class="iconfont icon-offline"></i></div>
              <div class="top2-tip">
                  <span>离线</span>
                  <p>{{fmStatus.离线+fmnStatus.离线}}</p>
              </div>
          </div>
      </div>
      <!-- main的主要部分 -->
      <div class="main-banner">
          <el-tabs v-model="activeName" @tab-click="handleClick">
              <!-- 终端设备 -->
              <el-tab-pane label="终端设备" name="first">
                  <div class="search-box">
                      <div>设备编号：<el-input v-model="inquire.deviceNo" placeholder="请输入内容"></el-input></div>
                      <div>设备名称：<el-input v-model="inquire.deviceName" placeholder="请输入内容"></el-input></div>
                      <div>设备类型：
                          <el-select v-model="inquire.deviceType" placeholder="请选择">
                              <el-option
                              v-for="item in fmDeviceType"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label">
                              </el-option>
                          </el-select>
                      </div>
                      <div>设备状态：
                          <el-select v-model="inquire.status" placeholder="请选择">
                              <el-option
                              v-for="item in deviceStatus"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label">
                              </el-option>
                          </el-select>
                      </div>
                      <div class="inp-btn">
                          <div class="btn" @click="fmSearch">
                                <i class="iconfont icon-search"></i>
                              <span>查询</span>
                          </div>
                          <div class="btn" @click="fmReset">
                                <i class="iconfont icon-reset"></i>
                              <span>重置</span>
                          </div>
                      </div>
                  </div>
                  <div class="btn-box">
                      <div class="btn" @click="addBox1" v-has="'add'">
                            <i class="iconfont icon-add"></i>
                          <span>添加</span>
                      </div>
                      <div class="btn">
                            <i class="iconfont icon-disable"></i>
                          <span>禁用</span>
                      </div>
                      <div class="btn">
                            <i class="iconfont icon-enable"></i>
                          <span>启用</span>
                      </div>
                      <div class="btn" @click="fmDel" v-has="'del'">
                            <i class="iconfont icon-delete"></i>
                          <span>删除</span>
                      </div>
                  </div>
                  <div class="list-box">
                      <el-table
                          ref="multipleTable"
                          :data="fmTable"
                          border
                          tooltip-effect="dark"
                          style="width: 100%"
                          @selection-change="fmGetId">
                          <el-table-column
                          type="selection"
                          width="55"
                          >
                          </el-table-column>
                          <el-table-column
                          prop="id"
                          label="序号"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="deviceNo"
                          label="设备编号"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="deviceName"
                          label="设备名称"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="deviceType"
                          label="设备类型"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="department"
                          label="所属部门"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="installAddr"
                          label="安装位置"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="safetyDir"
                          label="消防安全责任人"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="dirNum"
                          label="责任人电话"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="status"
                          label="设备状态"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="camera"
                          label="关联摄像头"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          label="操作">
                          <template slot-scope="scope">
                              <el-button @click="editBox1(scope.row)" type="text" size="small" v-has="'edit'">编辑</el-button>
                              <el-button @click="fmDetail(scope.row)" type="text" size="small">详情</el-button>
                              <el-button @click="fmDisposition(scope.row)" type="text" size="small" v-has="'edit'">配置</el-button>
                          </template>
                          </el-table-column>
                      </el-table>
                  </div>
                  <div class="list-bottom">
                      <el-pagination
                      @size-change="fmCurrentCount"
                      @current-change="fmCurrentPage"
                      :current-page="currentPage1"
                      :page-sizes="[5,10,15,20]"
                      :page-size="5"
                      layout="total, sizes, prev, pager, next, jumper"
                      :total="fmTotal"
                      >
                      </el-pagination>
                  </div>
              </el-tab-pane>
              <!-- 网关设备 -->
              <el-tab-pane label="网关设备" name="second">
                  <div class="search-box">
                      <div>设备编号：<el-input v-model="inquire.deviceNo" placeholder="请输入内容"></el-input></div>
                      <div>设备名称：<el-input v-model="inquire.deviceName" placeholder="请输入内容"></el-input></div>
                      <div>设备类型：
                          <el-select v-model="inquire.deviceType" placeholder="请选择">
                              <el-option
                              v-for="item in fmnDeviceType"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label">
                              </el-option>
                          </el-select>
                      </div>
                      <div>设备状态：
                          <el-select v-model="inquire.status" placeholder="请选择">
                              <el-option
                              v-for="item in deviceStatus"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label">
                              </el-option>
                          </el-select>
                      </div>
                      <div class="inp-btn">
                          <div class="btn" @click="fmnSearch">
                            <i class="iconfont icon-search"></i>
                              <span>查询</span>
                          </div>
                          <div class="btn" @click="fmnReset">
                            <i class="iconfont icon-reset"></i>
                              <span>重置</span>
                          </div>
                      </div>
                  </div>
                  <div class="btn-box">
                      <div class="btn" @click="addBox2" v-has="'add'">
                        <i class="iconfont icon-add"></i>
                          <span>添加</span>
                      </div>
                      <div class="btn">
                        <i class="iconfont icon-disable"></i>
                          <span>禁用</span>
                      </div>
                      <div class="btn">
                        <i class="iconfont icon-enable"></i>
                          <span>启用</span>
                      </div>
                      <div class="btn" @click="fmnDel" v-has="'del'">
                        <i class="iconfont icon-delete"></i>
                          <span>删除</span>
                      </div>
                  </div>
                  <div class="list-box">
                      <el-table
                          ref="multipleTable"
                          :data="fmnTable"
                          border
                          tooltip-effect="dark"
                          style="width: 100%"
                          @selection-change="fmnGetId">
                          <el-table-column
                          type="selection"
                          width="55"
                          >
                          </el-table-column>
                          <el-table-column
                          type="id"
                          prop="id"
                          label="序号"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="deviceNo"
                          label="设备编号"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="deviceName"
                          label="设备名称"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="deviceType"
                          label="设备类型"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="department"
                          label="所属部门"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="installAddr"
                          label="安装位置"
                          width="140">
                          </el-table-column>
                          <el-table-column
                          prop="safetyDir"
                          label="消防安全责任人"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="dirNum"
                          label="责任人电话"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="status"
                          label="设备状态"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          prop="camera"
                          label="关联摄像头"
                          width="120">
                          </el-table-column>
                          <el-table-column
                          label="操作">
                          <template slot-scope="scope">
                              <el-button @click="editBox2(scope.row)" type="text" size="small" v-has="'edit'">编辑</el-button>
                              <el-button @click="fmnDetail(scope.row)" type="text" size="small">详情</el-button>
                              <el-button @click="fmnDisposition(scope.row)" type="text" size="small" v-has="'edit'">配置</el-button>
                          </template>
                          </el-table-column>
                      </el-table>
                  </div>
                  <div class="list-bottom">
                      <el-pagination
                      @size-change="fmnCurrentCount"
                      @current-change="fmnCurrentPage"
                      :current-page="currentPage1"
                      :page-sizes="[5]"
                      :page-size="1"
                      layout="total, sizes, prev, pager, next, jumper"
                      :total="fmnTotal"
                      >
                      </el-pagination>
                  </div>
              </el-tab-pane>
          </el-tabs>
      </div>
      <!-- 遮罩层 -->
      <div class="mask" v-if="isShow1"></div>
      <!-- 增加和编辑弹出框 -->
      <div class="addBox" v-if="isShow2">
          <el-header style="height: 50px;">
              <span>新增设备</span>
              <i class="iconfont icon-x" @click="addDisappear" ></i>
          </el-header>
          <el-main>
              <p class="add-tip">基础信息</p>
              <div class="inp-box">
                <div class="inp">
                      <p>
                          <span class="symbol">*</span>
                          <span>设备编号：</span>
                      </p>
                      <el-input v-model="add.deviceNo" placeholder="请输入内容"></el-input>
                  </div>
                  <div class="inp">
                      <p>
                          <span class="symbol">*</span>
                          <span>设备名称：</span>
                      </p>
                      <el-input v-model="add.deviceName" placeholder="请输入内容"></el-input>
                  </div>
              </div>
              <div class="inp-box">
                <div class="inp">
                      <p>
                          <span class="symbol">*</span>
                          <span>设备状态：</span>
                      </p>
                      <el-select v-model="add.status" placeholder="请选择">
                        <el-option
                        v-for="item in deviceStatus"
                        :key="item.value"
                        :label="item.label"
                        :value="item.label">
                        </el-option>
                    </el-select>
                  </div>
                  <div class="inp">
                      <p>
                          <span class="symbol">*</span>
                          <span>设备类型：</span>
                      </p>
                      <el-select v-model="add.deviceType" placeholder="请选择">
                          <el-option
                          v-for="item in deviceType"
                          :key="item.value"
                          :label="item.label"
                          :value="item.label">
                          </el-option>
                      </el-select>
                  </div>
              </div>
              <div class="inp-box">
                  
                  <div class="inp">
                        <p>
                          <span class="symbol">*</span>
                          <span>关联摄像头：</span>
                      </p>
                      <el-input v-model="add.camera" placeholder="请输入内容"></el-input>
                  </div>
              </div>
              <p class="add-tip">消防安全责任人</p>
              <div class="responsible-person">
                  <div class="rp-top">
                      <div class="rpt-l">第一责任人</div>
                      <div class="rpt-r"><i class="iconfont icon-add"></i></div>
                  </div>
                  <div class="rp-btm">
                      <p>
                          <span class="symbol">*</span>
                          <span>责任人：</span>
                          <el-input v-model="add.safetyDir" placeholder="请输入内容"></el-input>
                      </p>
                      <p>
                          <span class="symbol">*</span>
                          <span>电话：</span>
                          <el-input v-model="add.dirNum" placeholder="请输入内容"></el-input>
                      </p>
                  </div>
              </div>
              <p class="add-tip">安装位置</p>
              <div class="install-box">
                  <p>
                      <span class="symbol">*</span>
                      <span>安装点位：</span>
                      <span class="inp-explain">设备安装点位由所属部门+安装位置描述两部分构成</span>
                  </p>
                  <div class="inp-box">
                      <div class="inp">
                          <el-select v-model="add.department" placeholder="请选择">
                              <el-option
                              v-for="item in department"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label">
                              </el-option>
                          </el-select>
                      </div>
                      <p>-</p>
                      <div class="inp">
                          <el-input v-model="add.installAddr" placeholder="请输入内容"></el-input>
                      </div>
                  </div>
              </div>
              <div class="add-btn">
                  <div class="btn" @click="addDisappear">
                    <i class="iconfont icon-return"></i>
                      <span>取消</span>
                  </div>
                  <div class="btn" @click="addSave">
                    <i class="iconfont icon-save"></i>
                      <span>保存</span>
                  </div>
              </div>
          </el-main>
      </div>
      <!-- fm配置弹出框 -->
        <div class="dispositionBox" v-if="isShow3">
          <el-header style="height: 50px;">
              <span>{{deviceName1}}-配置</span>
              <i class="iconfont icon-x" @click="addDisappear"></i>
          </el-header>
          <el-main>
              <div class="inp">
                  <p>
                      <span class="symbol">*</span>
                      <span>通讯周期：</span>
                  </p>
                  <el-input v-model="disposition1.commCycle" placeholder="请输入内容">
                      <p slot="suffix">秒/s</p>
                  </el-input>
              </div>
              <div class="inp">
                  <p>
                      <span class="symbol">*</span>
                      <span>报警类型：</span>
                  </p>
                  <el-select v-model="disposition1.warningType" placeholder="请选择">
                      <el-option
                      v-for="item in fmAlarmType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.label">
                      </el-option>
                  </el-select>
              </div>
              <div class="inp">
                  <p>
                      <span class="symbol">*</span>
                      <span>报警阈值：</span>
                  </p>
                  <el-input v-model="disposition1.warningNum" placeholder="请输入内容">
                      <p slot="suffix">%LEL</p>
                  </el-input>
              </div>
              <div class="add-btn">
                  <div class="btn" @click="addDisappear">
                    <i class="iconfont icon-return"></i>
                      <span>取消</span>
                  </div>
                  <div class="btn" @click="addSave">
                    <i class="iconfont icon-save"></i>
                      <span>保存</span>
                  </div>
              </div>
          </el-main>
        </div>
        <!-- fmn配置弹出框 -->
        <div class="dispositionBox2" v-if="isShow5">
            <el-header style="height: 50px;">
              <span>{{deviceName2}}-参数配置</span>
              <i class="iconfont icon-x" @click="addDisappear"></i>
          </el-header>
          <el-main>
              <div class="inp">
                <div>
                  <p>
                      <span class="symbol">*</span>
                      <span>上传周期：</span>
                  </p>
                  <el-input v-model="disposition2.updateCycle" placeholder="请输入内容">
                      <p slot="suffix">秒/s</p>
                  </el-input>
                </div> 
                <div>
                  <p>
                      <span class="symbol">*</span>
                      <span>采样周期：</span>
                  </p>
                  <el-input v-model="disposition2.samplingCycle" placeholder="请输入内容">
                      <p slot="suffix">秒/s</p>
                  </el-input>
                </div> 
              </div>
              <div class="inp2">
                <p>
                    <span class="symbol">*</span>
                    <span>蜂蜜器开关：</span>
                </p>
                <el-switch
                v-model="disposition2.buzzerSwitch"
                active-color="#13ce66"
                inactive-color="#ff4949">
                </el-switch>
              </div>
              <div class="inp">
                <div>
                  <p>
                      <span class="symbol">*</span>
                      <span>烟雾报警等级：</span>
                  </p>
                  <el-select v-model="disposition2.smokeWarning" placeholder="请选择">
                      <el-option
                      v-for="item in fmnAlarmType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.label">
                      </el-option>
                  </el-select>
                </div>
              </div>
              <div class="inp2">
                <div>
                  <p>
                      <span class="symbol">*</span>
                      <span>温度报警上限：</span>
                  </p>
                  <el-input v-model="input" placeholder="请输入内容">
                      <p slot="suffix">℃</p>
                  </el-input>
                </div> 
              </div>
              <div class="add-btn">
                  <div class="btn" @click="addDisappear">
                    <i class="iconfont icon-return"></i>
                      <span>取消</span>
                  </div>
                  <div class="btn" @click="addSave">
                    <i class="iconfont icon-save"></i>
                      <span>保存</span>
                  </div>
              </div> 
          </el-main>
        </div>
      </div>
      <!-- 详情页面 -->
      <Detail v-if="isShow4" 
      @detailFn="detailFn(arguments)" 
      :fmId="fmId" 
      :fmnId="fmnId" 
      :detailNum="detailNum" 
      :deviceNo="deviceNo">
      </Detail>
  </el-main>
</template>
  

<script>
import Detail from '@/components/fireDetection/Detail.vue';

  export default {
    components:{Detail},
    data() {
      return {
        addNum:'',
        editNum:'',
        activeName: 'first',
        currentPage1: 1,
        fmTotal:1,
        fmnTotal:1,
        fmPage:1,
        fmnPage:1,
        fmCount:5,
        fmnCount:5,
        isShow:true,
        isShow1:false,
        isShow2:false,
        isShow3:false,
        isShow4:false,
        isShow5:false,
        fmnSwitch:true,
        disabled:false,
        input:'',
        value1:'111',
        typeValue: '',
        stateValue: '',
        fmTable: [],
        fmnTable: [],
        fmId:'',
        fmnId:'',
        detailNum:'',
        deviceNo:'',
        add:{
            "camera": "",
            "department": "",
            "deviceName": "",
            "deviceNo": "",
            "deviceType": "",
            "dirNum": "",
            "id": 0,
            "installAddr": "",
            "safetyDir": "",
            "status": ""
        },
        inquire:{
            "deviceNo": "",
            "deviceName": "",
            "deviceType": "",
            "status": "",
        },
        disposition1:{
            "commCycle":0,
            "warningType":"",
            "warningNum":0
        },
        deviceName1:'',
        disposition2:{
            "buzzerSwitch": true,
            "samplingCycle": 0,
	        "smokeWarning": "",
            "temperWarning": 0,
	        "updateCycle": 0
        },
        deviceName2:'',
        // 状态
        fmStatus:{},
        fmnStatus:{},
        // 删除的id
       fmDelId:[],
       fmnDelId:[],
       // fm选择框 
       deviceType:[],  
       fmDeviceType:[
        {value:1,label: '可燃气体探测器'},
        {value:2,label: '手动火灾报警按钮'},
        {value:3,label: '消火栓按钮'},
        {value:4,label: '火灾探测器'},
        {value:5,label: '典型感文火灾探测器'},
        {value:6,label: '点型光电感烟火灾探测器'},
        {value:7,label: '输入模块'},
        {value:8,label: '输入/输出模块'},
        {value:9,label: '消防水泵'},
        {value:10,label: '喷淋泵'},
        {value:11,label: '水流指示器'},
        {value:12,label: '信号阀'},
        {value:13,label: '防火阀'},
        {value:14,label: '防烟排烟风机'},
        {value:15,label: '警报装置'},
        {value:16,label: '排烟防火阀'},
        {value:17,label: ''},
       ],
       deviceStatus:[
       {value:1,label: '正常'},
       {value:2,label: '报警'},
       {value:3,label: '故障'},
       {value:4,label: '离线'},
       {value:5,label: '启动'},
       {value:6,label: '延时'},
       {value:7,label: '屏蔽'},
       {value:8,label: '监管'},
       {value:9,label: '反馈'},
       {value:10,label: '禁用'},
       {value:11,label: ''},
       ],
        //   fm中添加中的选择
        department:[
            {value:1,label: '综合办公楼'},
            {value:2,label: '产线厂房'},
            {value:3,label: '仓储楼'},
            {value:4,label: '活动中心'},
        ],
        placeName:[
            {value:1,label: '场所01'},
            {value:2,label: '场所02'},
            {value:3,label: '场所03'},
        ],
        //   fm中配置中的选择
        fmAlarmType:[
            {value:1,label: '标准'},
            {value:2,label: '多级超限告警'}
        ],
        // fmn中的选择
        fmnDeviceType:[
        {value:1,label: '用户传输装置'},
        {value:2,label: '无线网关控制起'},
        {value:3,label: '家用火灾控制起'},
        {value:4,label: '职能DTU/RTU'},
        {value:5,label: ''}
        ],
        //   fmn中配置中的选择
        fmnAlarmType:[
            {value:1,label: '标准'},
            {value:2,label: '高灵明度'},
            {value:3,label: '低灵明度'}
        ],
      };
    },
    mounted:function(){
        this.fmRender();
        this.fmnRender();
    },
    methods: {
        // 时间
        time(){
            return new Date().toLocaleString();
        },
        handleClick(tab, event) {
            console.log(tab, event);
            /* if(tab.index==1){
                this.fmnRender()
            } */
        },
        // 分页部分
        fmCurrentCount(val) {
            console.log(`每页 ${val} 条`);
            this.fmCount=val;
            this.fmRender();
        },
        fmCurrentPage(val) {
            this.fmPage=val;
            this.fmRender();
        },
        fmnCurrentCount(val) {
            console.log(`每页 ${val} 条`);
            this.fmCount=val;
            this.fmRender();
        },
        fmnCurrentPage(val) {
            this.fmPage=val;
            this.fmRender();
        },
        clean(){
          this.add={
            "camera": "",
            "department": "",
            "deviceName": "",
            "deviceNo": "",
            "deviceType": "",
            "dirNum": "",
            "id": 0,
            "installAddr": "",
            "safetyDir": "",
            "status": ""
          }
        },
        // 增加框出现
        addBox1(){
            this.isShow1=true;
            this.isShow2=true;
            this.disabled=false;
            this.addNum=1;
            this.deviceType=this.fmDeviceType;
        },
        addBox2(){
            this.isShow1=true;
            this.isShow2=true;
            this.disabled=false;
            this.addNum=2;
            this.deviceType=this.fmnDeviceType;
        },
        // 增加框消失
        addDisappear(){
            this.isShow1=false;
            this.isShow2=false;
            this.isShow3=false;
            this.isShow5=false;
            this.clean();
        },
        // 编辑框出现
        editBox1(v){
            this.isShow1=true;
            this.isShow2=true;
            this.disabled=true;
            this.addNum=3;
            this.deviceType=this.fmDeviceType;
            this.add={
                "camera": v.camera,
                "department": v.department,
                "deviceName": v.deviceName,
                "deviceNo": v.deviceNo,
                "deviceType": v.deviceType,
                "dirNum": v.dirNum,
                "id": v.id,
                "installAddr": v.installAddr,
                "safetyDir": v.safetyDir,
                "status": v.status
          }
        },
        editBox2(v){
            this.isShow1=true;
            this.isShow2=true;
            this.disabled=true;
            this.addNum=4;
            this.deviceType=this.fmnDeviceType;
            this.add={
                "camera": v.camera,
                "department": v.department,
                "deviceName": v.deviceName,
                "deviceNo": v.deviceNo,
                "deviceType": v.deviceType,
                "dirNum": v.dirNum,
                "id": v.id,
                "installAddr": v.installAddr,
                "safetyDir": v.safetyDir,
                "status": v.status
          }
        },
        // 增加和编辑确认
        addSave(){
            if(this.addNum==1){
                this.$axios({
                url:'/fireMonitoring',
                method:'post',
                data:this.add
                }).then((res)=>{
                    // 查看搜索框内容
                    console.log(res.data.msg);
                    if(res.data.msg=='success'){
                        this.clean();
                        this.addDisappear();
                        this.fmRender();
                        this.$message.success('添加成功!');
                    }else {
                        this.$message.error("添加失败！");
                    }
                })
            }else if(this.addNum==2){
                this.$axios({
                url:'/fireMonitoringNet',
                method:'post',
                data:this.add
                }).then((res)=>{
                    // 查看搜索框内容
                    console.log(res.data.msg);
                    if(res.data.msg=='success'){
                        this.clean();
                        this.addDisappear();
                        this.fmnRender();
                        this.$message.success('添加成功!');
                    }else {
                        this.$message.error("添加失败！");
                    }
                })
            }else if(this.addNum==3){
                let addCopy={...this.add};
                let addConcat=Object.assign(addCopy,this.disposition1);
                console.log(addConcat);
                this.$axios({
                    url:'/fireMonitoring',
                    method:'PUT',
                    data:addConcat
                }).then((res)=>{
                    console.log(res.data.msg);
                    if(res.data.msg=='success'){
                        this.addDisappear();
                        this.fmRender();
                        this.$message.success('编辑成功!');
                    }else {
                        this.$message.error("编辑失败！");
                    }
                })
            }else if(this.addNum==4){
                let addCopy={...this.add};
                let addConcat=Object.assign(addCopy,this.disposition2);
                console.log(addConcat);
                this.$axios({
                    url:'/fireMonitoringNet',
                    method:'put',
                    data:addConcat
                }).then((res)=>{
                    // 查看搜索框内容
                    console.log(res.data.msg);
                    if(res.data.msg=='success'){
                        this.addDisappear();
                        this.fmnRender();
                        this.$message.success('编辑成功!');
                    }else {
                        this.$message.error("编辑失败！");
                    }
                })
            }
        },
        // 渲染
        fmRender(){
            this.$axios({
                url:`/fireMonitorings/${this.fmPage}/${this.fmCount}`,
                method:'get'
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmTable=res.data.data;
                    // this.fmTable=fmTableAll.slice((this.fmPage-1)*this.fmCount,this.fmPage*this.fmCount);
                    this.fmTotal=res.data.total;
                }else {
                    this.$message.error("数据加载失败！");
                }
            });
            this.$axios({
                url:'/fireMonitoring/count',
                method:'get'
            }).then((res)=>{
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmStatus=res.data.data;
                }
            })
        },
        fmnRender(){
            this.$axios({
                url:`/fireMonitoringNet/${this.fmnPage}/${this.fmnCount}`,
                method:'get'
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmnTable=res.data.data;
                    // this.fmnTable=fmTableAll.slice((this.fmnPage-1)*this.fmnCount,this.fmnPage*this.fmnCount);
                    this.fmnTotal=res.data.total;
                }else {
                    this.$message.error("数据加载失败！");
                }
            });
            this.$axios({
                url:'/fireMonitoringNet/count',
                method:'get'
            }).then((res)=>{
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmnStatus=res.data.data;
                }
            })
        },
        // 重置部分
        fmReset(){
            this.inquire={
            "deviceNo": "",
            "deviceName": "",
            "deviceType": "",
            "status": ""
            }
            // this.fmPage=1;
            this.fmRender();
        },
        fmnReset(){
            this.inquire={
            "deviceNo": "",
            "deviceName": "",
            "deviceType": "",
            "status": ""
            }
            this.fmnRender();
        },
        refresh(){
            this.inquire={
            "deviceNo": "",
            "deviceName": "",
            "deviceType": "",
            "status": ""
            };
            this.fmRender();
            this.fmnRender();
        },
        // 搜索部分
        fmSearch(){
            this.$axios({
                url:`/queryFireMonitoringByCondition/${this.fmPage}/${this.fmCount}`,
                method:'get',
                params:this.inquire
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmTable=res.data.data;
                    this.fmTotal=res.data.total;
                }else {
                    this.$message.error("数据加载失败！");
                }
            })
        },
        fmnSearch(){
            this.$axios({
                url:`/queryFireMonitoringNetByCondition/${this.fmPage}/${this.fmCount}`,
                method:'get',
                params:this.inquire
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmnTable=res.data.data;
                    this.fmnTotal=res.data.total;
                }else {
                    this.$message.error("数据加载失败！");
                }
            })
        },
        // 删除部分
        fmGetId(val){
            this.fmDelId=[];
            for (let key in val) {
                this.fmDelId[key]=val[key].id;
            }
        },
        fmnGetId(val){
            this.fmnDelId=[];
            for (let key in val) {
                this.fmnDelId[key]=val[key].id;
            }
        },
        fmDel(){
            this.$axios({
                url:'/fireMonitorings',
                method:'delete',
                data:this.fmDelId
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmRender();
                    this.$message.success('删除成功!');
                }else {
                    this.$message.error("删除失败！");
                }
            })
        },
        fmnDel(){
            this.$axios({
                url:'/fireMonitoringNet',
                method:'delete',
                data:this.fmnDelId
            }).then((res)=>{
                // 查看搜索框内容
                console.log(res.data.msg);
                if(res.data.msg=='success'){
                    this.fmnRender();
                    this.$message.success('删除成功!');
                }else {
                    this.$message.error("删除失败！");
                }
            })
        },
        // 配置框部分
        fmDisposition(v){
            this.isShow1=true;
            this.isShow3=true;
            this.addNum=3;
            this.disposition1={
                "commCycle":v.commCycle,
                "warningType":v.warningType,
                "warningNum":v.warningNum
            }
            this.deviceName1=v.deviceName
        },
        fmnDisposition(v){
            this.isShow1=true;
            this.isShow5=true;
            this.addNum=4;
            this.disposition2={
                "buzzerSwitch": v.buzzerSwitch,
                "samplingCycle": v.samplingCycle,
                "smokeWarning": v.smokeWarning,
                "temperWarning": v.temperWarning,
                "updateCycle": v.updateCycle
            }
            this.deviceName2=v.deviceName
        },
        fmDetail(v){
            this.isShow4=true;
            this.isShow=false;
            this.fmId=v.id;
            this.deviceNo=v.deviceNo;
            this.detailNum=1;
        },
        fmnDetail(v){
            this.isShow4=true;
            this.isShow=false;
            this.fmnId=v.id;
            this.deviceNo=v.deviceNo;
            this.detailNum=2;
        },
        detailFn(v){
            this.isShow4=v[1];
            this.isShow=v[0];
        },
        
    }
  }
  </script>
  
<style scoped lang="less">
    .el-main {
        background-color: #E9EEF3;
        color: #333;
        text-align: center;
        line-height: 160px;
        padding:20px 0px 0px 0px;
        position:relative;
        height: 100%;
    }

// 主页页面
    // 头部
    .main-top{
        width: 100%;
        height: 80px;
        background: #E9EEF3;
        margin-bottom: 20px;
        display: flex;
        justify-content: space-between;
    }
.top1{
    width: 380px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding-left: 20px;
}
.top1-tip{
    width: 100%;
    height: 40px;
    font-size: 16px;
    font-weight: 700;
    line-height: 40px;
    text-align: start;
    display: flex;
}
.refresh{
        width: 95px;
        height: 30px;
        border: 1px solid #f2f2f2;
        border-radius: 3px;
        margin-left: 100px;
        margin-top: 10px;
        font-size: 14px;
        font-weight:500;
        display: flex;
        align-items: center;
        justify-content: space-around;
        &:hover{
            cursor: pointer;
            color: #fff;
            background: #1890ff;
            .iconfont{
                color: #fff;
            }
        }
        .iconfont{
            color: #1890ff;
            
        }
    }
.top1-time{
    width: 100%;
    height: 40px;
    font-size: 12px;
    line-height: 40px;
    text-align: start;
    
}
.top2{
    width: 200px;
    height: 100%;
    background: #fff;
    line-height: 80px;
    display: flex;
    .top2-icon{
        width: 100px;
        .iconfont{
            font-size: 36px;
            border-radius: 3px;
        }
        .icon-equipment{
            color: #fff;
            background: #1890ff;
        }
        .icon-normal{
            color: #00e266;
        }
        .icon-alarm{
            color: #d4321c;
        }
        .icon-fault{
            color: #fff;
            background: #ec9d26;
        }
        .icon-offline{
            color: #fff;
            background: #cccccc;
        }
    }
    .top2-tip{
        flex: 1;
        height: 100%;
        line-height: 20px;
        text-align: center;;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        span{
            font-size: 14px;
        }
        p{
            font-size: 18px;
            font-weight: 700;
        }
    }
}
    // 中间部分
    .main-banner{
        padding: 0px 20px;
        height: calc(100% - 100px);
        background: #fff;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
    /deep/.el-tabs__header{
        line-height: 50px;
        height: 50px;
    }

    .search-box{
        height: 60px;
        display: flex;
        line-height: 30px;
        align-items: center;
        justify-content: space-between;
        font-size: 12px;
        .el-input{
            width: 160px;
            height: 30px;
            /deep/.el-input__inner{
                width: 160px;
                height: 30px;
            }
            
        }
        .el-select{
            /deep/.el-input--suffix{
                width: 160px;
                height: 30px;
            }
            /deep/.el-input__inner{
                width: 160px;
                height: 30px;
            }
            /deep/.el-input__icon{
                line-height: 30px;
            }
        }
        .inp-btn{
            width: 200px;
            display: flex;
            justify-content: space-around;
            .btn{
                width: 80px;
                height: 30px;
                border: 1px solid #f2f2f2;
                border-radius: 3px;
                line-height: 30px;
                font-size: 12px;
                display: flex;
                justify-content: space-around;
                border-radius: 5px;
                &:hover{
                    cursor: pointer;
                    color: #fff;
                    background: #1890ff;
                    .iconfont{
                        color: #fff;
                    }
                }
                .iconfont{
                    color: #1890ff;
                    
                }
            }
        }
    }
    /deep/.el-table{
        color:#333;
        font-size:12px;
    }
    .btn-box{
        height: 60px;
        display: flex;
        line-height: 60px;
        align-items: center;
        .btn{
            width: 80px;
            height: 35px;
            border: 1px solid #f2f2f2;
            line-height: 35px;
            font-size: 14px;
            display: flex;
            justify-content: space-around;
            margin-right: 20px;
            border-radius: 3px;
            &:hover{
                cursor: pointer;
                color: #fff;
                background: #1890ff;
                .iconfont{
                color: #fff;
                    }
                }
            .iconfont{
                color: #1890ff;
                
            }
        }
    }
    .list-box{
        height: 360px;
        line-height: 40px;
        overflow:scroll;
        overflow-x:hidden;
    }
    .list-bottom{
            line-height: 50px;
            height: 50px;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top:50px;
        }


// 遮罩层
.mask{
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background:rgba(0, 0, 0, 0.5);
    filter: opacity(60%);
    opacity: 60%;
    z-index: 3;
}
        
// 弹出框
.addBox{
    width: 720px;
    height: 600px;
    background: #fff;
    position:absolute;
    top: 0px;
    left: 240px;
    z-index: 4;
    .el-header{
        height: 30px;
        line-height: 30px;
        background: #f2f2f2;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .el-main{
        background: #fff;
        height: 650px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        line-height: 50px;
        padding: 0px 20px;
        .add-tip{
            font-weight: 700;
        }
        .inp-box{
            width: 100%;
            height: 70px;
            display: flex;
            font-size: 14px;
            display: flex;
            justify-content: space-between;
            .inp{
                width: 300px;
                height: 70px;
                line-height: 35px;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                .symbol{
                    color: red;
                }
                .el-input{
                    width: 300px;
                    height: 30px;
                    /deep/.el-input__inner{
                        width: 300px;
                        height: 30px;
                    }
                    
                }
                .el-select{
                    /deep/.el-input--suffix{
                        width: 300px;
                        height: 30px;
                    }
                    /deep/.el-input__inner{
                        width: 300px;
                        height: 30px;
                    }
                    /deep/.el-input__icon{
                        line-height: 30px;
                    }
                }

            }
        }
        .responsible-person{
            width: 660px;
            height: 114px;
            line-height: 20px;
            border-left:1px solid #d7d7d7 ;
            border-bottom:1px solid #d7d7d7 ;
            border-radius: 3px;
            .rp-top{
                height: 40px;
                line-height: 44px;
                display: flex;
                .rpt-l{
                    width: 120px;
                    border-top: 1px solid #d7d7d7;
                    border-left: 1px solid #d7d7d7;
                    border-radius: 3px;
                }
                .rpt-r{
                    flex: 1;
                    border-left:1px solid #d7d7d7 ;
                    border-bottom:1px solid #d7d7d7 ;
                    border-radius: 3px;
                    display:flex;
                    .iconfont{
                        margin-left: 10px;
                        font-size: 24px;
                        color:#1890ff;
                    }
                }
            }
            .rp-btm{
                height: 70px;
                line-height: 70px;
                display: flex;
                font-size: 14px;
                justify-content: space-evenly;
                border-right:1px solid #d7d7d7 ;
                border-radius: 3px;
                p{
                    display: flex;
                    // justify-content: space-around;
                    .symbol{
                        color: red;
                    }
                    .el-input{
                    width: 200px;
                    height: 30px;
                        /deep/.el-input__inner{
                            width: 200px;
                            height: 30px;
                        }
                    }
                }
                
            }
        }
        
    }
    
}
.install-box{
    width: 100%;
    height: 70px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    p{
        height: 30px;
        line-height: 30px;
        display: flex;
        .symbol{
            color: red;
        }
        .inp-explain{
            font-size: 14px;
            color: #7f7f7f;
        }
    }
    .inp-box{
        height: 40px;
        // line-height: 50px;
        .inp{
        width: 300px;
        height: 40px;
        line-height: 35px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        
        .el-input{
            width: 300px;
            height: 30px;
            /deep/.el-input__inner{
                width: 300px;
                height: 30px;
            }
            
        }
        .el-select{
            /deep/.el-input--suffix{
                width: 300px;
                height: 30px;
            }
            /deep/.el-input__inner{
                width: 300px;
                height: 30px;
            }
            /deep/.el-input__icon{
                line-height: 30px;
            }
        }

    }
    }
    
}
.icon-x{
    cursor: pointer;
}
.add-btn{
    width:100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    .btn{
        width: 80px;
        height: 35px;
        border: 1px solid #f2f2f2;
        border-radius: 3px;
        line-height: 35px;
        font-size: 14px;
        display: flex;
        justify-content: space-around;
        margin-right: 20px;
        &:hover{
            cursor: pointer;
            color: #fff;
            background: #1890ff;
            .iconfont{
                color: #fff;
            }
        }
        .iconfont{
            color: #1890ff;
            
        }
    }
}

// fm配置弹出框
.dispositionBox{
    width: 460px;
    height: 380px;
    background: #fff;
    position:absolute;
    top: 0px;
    left: 300px;
    z-index: 4;
    .el-header{
        height: 30px;
        line-height: 30px;
        background: #f2f2f2;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .el-main{
        background: #fff;
        height: 350px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        line-height: 50px;
        padding: 0px 20px;
        margin-top: 10px;
        .inp{
            width: 300px;
            height: 90px;
            line-height: 35px;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            font-size: 12px;
            .symbol{
                color: red;
            }
            .el-input{
                width: 300px;
                height: 30px;
                /deep/.el-input__inner{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__suffix{
                    margin-right: 10px;
                    color: #333;
                    font-size: 12px;
                }
            }
            .el-select{
                /deep/.el-input--suffix{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__inner{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__icon{
                    line-height: 30px;
                }
            }

        }
    }
}

// fmn配置弹出框
.dispositionBox2{
    width: 460px;
    height: 500px;
    background: #fff;
    position:absolute;
    top: 0px;
    left: 300px;
    z-index: 4;
    .el-header{
        height: 50px;
        line-height: 50px;
        background: #f2f2f2;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .el-main{
        background: #fff;
        height: 450px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        line-height: 50px;
        padding: 0px 20px;
        margin-top: 10px;
        .inp{
            width: 400px;
            height: 90px;
            line-height: 35px;
            display: flex;
            // align-items: center;
            justify-content: space-between;
            font-size: 12px;
            // margin-top: 20px;
            p{
                display: flex;
            }
            .symbol{
                color: red;
            }
            .el-input{
                width: 180px;
                height: 30px;
                /deep/.el-input__inner{
                    width: 180px;
                    height: 30px;
                }
                /deep/.el-input__suffix{
                    margin-right: 10px;
                    color: #333;
                    font-size: 12px;
                }
            }
            .el-select{
                /deep/.el-input--suffix{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__inner{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__icon{
                    line-height: 30px;
                }
            }
        }
        .inp2{
            width: 300px;
            height: 90px;
            line-height: 35px;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            font-size: 12px;
            // margin-top: 20px;
            p{
                display: flex;
            }
            .symbol{
                color: red;
            }
            .el-input{
                width: 300px;
                height: 30px;
                /deep/.el-input__inner{
                    width: 300px;
                    height: 30px;
                }
                /deep/.el-input__suffix{
                    margin-right: 10px;
                    color: #333;
                    font-size: 12px;
                }
            }
        }
    }
}











  </style>